package com.cwx.mychat.exception;

import com.cwx.mychat.entity.enums.ExceptionBizCodeEnum;

public class BusinessException extends Exception{

    private Integer code;

    public BusinessException(Integer code){
        super(ExceptionBizCodeEnum.getByCode(code).getMsg());
        this.code = code;
    }

    public BusinessException(String msg){
        super(msg);
    }

    public BusinessException(ExceptionBizCodeEnum exceptionBizCodeEnum){
        super(exceptionBizCodeEnum.getMsg());
        this.code = exceptionBizCodeEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
